package com.it.demo.mq.comsumer;

import org.apache.activemq.command.ActiveMQTextMessage;
import org.apache.activemq.command.Message;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.stereotype.Component;

import javax.jms.JMSException;

@Component
public class ExpireConsumer {

    @JmsListener(destination="order.expire.queue")
    public void onMessage(Message message) {

        ActiveMQTextMessage msg = (ActiveMQTextMessage) message;
        try {
            String text = msg.getText();
            System.out.println("本次要删除的数为：" + text);
        } catch (JMSException e) {
            e.printStackTrace();
        }
    }

}
